import React from 'react';

const TodayDate: React.FC = () => {
    // 创建一个日期对象
    const currentDate = new Date();

    // 从日期对象提取所需的部分
    const day = String(currentDate.getDate()).padStart(2, '0'); // 获取日期
    const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 获取月份（0-11）
    const year = currentDate.getFullYear(); // 获取年份
    const weekdayOptions: Intl.DateTimeFormatOptions = { weekday: 'long' };
    const weekday = currentDate.toLocaleDateString('zh-CN', weekdayOptions); // 获取星期

    return (
        <div style={{ fontFamily: 'Arial, sans-serif' }}>
            <h2 style={{ margin: 0 }}>
                <span style={{ fontSize: '2em' }}>{day}</span>{" "}
                /{month}{" "}
                {year}
            </h2>
            <h4 style={{ margin: 0 }}>{weekday}</h4> {/* 星期在下一行 */}
        </div>
    );
};

export default TodayDate;
